package com.yuw.hw20190214;

public class SalesEmployee extends ColaEmployee {
    // 成员变量
    // 月销售额
    private double monthSaleTotal;
    // 提成率
    private double saleRate;
    // 行为方法

    // 此处使用了多态：子类重写了父类的同名方法
    @Override
    public double getSalary(int month) {
        // 计算销售人员工资
        double mySalary = monthSaleTotal*saleRate;
        // 计算有没有生日金
        mySalary += super.getSalary(month);
        return mySalary;
    }

    public SalesEmployee() {
    }

    public SalesEmployee(String empName, int empBirthdayMonth, double monthSaleTotal, double saleRate) {
        super(empName, empBirthdayMonth);
        this.monthSaleTotal = monthSaleTotal;
        this.saleRate = saleRate;
    }

    public double getMonthSaleTotal() {
        return monthSaleTotal;
    }

    public void setMonthSaleTotal(double monthSaleTotal) {
        this.monthSaleTotal = monthSaleTotal;
    }

    public double getSaleRate() {
        return saleRate;
    }

    public void setSaleRate(double saleRate) {
        this.saleRate = saleRate;
    }
}
